home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1994 November / macformat-018.iso / Demos / Extend 3.0 Demo / Demo Libraries / Demo Generic Lib / Demo Generic Lib.rsrc / MODL_25381_Constant < prev    next >
Encoding:
Text File  |  1994-06-22  |  2.4 KB  |  108 lines

  1. double    timeArray[];
  2. integer    hidden;
  3.  
  4. **    This block outputs a constant value
  5. **    Copyright © 1989-1994 by Imagine That,Inc.
  6. **    All Rights Reserved.
  7. **    Extend Generic Library, Constant block; Alfy Riddle
  8. **        modified     3/3/92  JSL modified for V2.0
  9. **                    8/18/93 JSL added animation
  10. **                    10/15/93 JSL allowed noValues to be output
  11. **                    2/14/94  DJK modified trace and report
  12. **                    3/10/94  DJK added block label to trace & report
  13.  
  14. procedure    calc()
  15. {
  16.     if (animationOn)
  17.         {
  18.         if (hidden)
  19.             {
  20.             animationText(1, conValue);
  21.             animationShow(1);
  22.             hidden = FALSE;
  23.             }
  24.         }
  25.     else
  26.         {
  27.         if (!hidden)
  28.             {
  29.             animationHide(1, FALSE);
  30.             hidden = TRUE;
  31.             }
  32.         }
  33.  
  34.     cOut = valueIn + conValue;
  35.  
  36.     ** sysGlobal2 is the file reference number for the DEBUG TRACE
  37.     if( sysGlobal2 != 0.0 )   ** 0 is error, check for open file for TRACE
  38.         {
  39. // template for report:      |BLOCK NAME *****************|block number |BLOCK NUMBER*******
  40.         fileWrite(sysGlobal2,"Constant                     block number "+(MyBlockNumber())+".  Current Time:"+currentTime+".","",True);
  41.         if(getBlockLabel(myBlockNumber()) != "")
  42.             fileWrite(sysGlobal2,"Block Label: "+getBlockLabel(myBlockNumber()),"",True);
  43.         fileWrite(sysGlobal2,"     Input = "+valueIn,"",True);
  44.         fileWrite(sysGlobal2,"     Output = "+cOut,"",True);
  45.         fileWrite(sysGlobal2," ","",True);
  46.         }
  47. }
  48.  
  49.  
  50. on simulate
  51. {
  52.     calc();
  53. }
  54.  
  55.  
  56. on createBlock
  57. {
  58.     conValue = 1;
  59. }
  60.  
  61. on dialogClose
  62. {
  63.     animationHide(1, FALSE);
  64.     hidden = TRUE;
  65. }
  66.  
  67. on initSim
  68. {
  69.     if( getPassedArray(sysGlobal0, timeArray) )
  70.         getSimulateMsgs(FALSE);
  71.         
  72.     if (animationOn)
  73.         {
  74.         animationText(1, conValue);
  75.         animationShow(1);
  76.         hidden = FALSE;
  77.         }
  78.     else
  79.         {
  80.         animationHide(1, FALSE);
  81.         hidden = TRUE;
  82.         }
  83. }
  84.  
  85.  
  86. on checkdata
  87. {
  88.     sysGlobal1 = 0.0;    ** prevent false reports
  89.     sysGlobal2 = 0.0;    ** prevent false debugs
  90. }
  91.  
  92.  
  93. on endSim
  94. {
  95.     ** sysGlobal1 is the file reference number for the TEXT REPORT
  96.     if( sysGlobal1 != 0.0 )  ** 0 is error, check for open file for REPORT
  97.         {
  98. // template for report:      |BLOCK NAME *****************|block number |BLOCK NUMBER*******
  99.         fileWrite(sysGlobal1,"Constant                     block number "+(MyBlockNumber()),"",True);
  100.         if(getBlockLabel(myBlockNumber()) != "")
  101.             fileWrite(sysGlobal1,"Block Label: "+getBlockLabel(myBlockNumber()),"",True);
  102.         fileWrite(sysGlobal1,"     Constant = "+conValue,"",True);
  103.         if( comments != "" )
  104.             fileWrite(sysGlobal1,"     Comments = "+comments,"",True);        
  105.  
  106.         fileWrite(sysGlobal1," ","",True);
  107.         }
  108. }